package com.banana.manager.forest.controller.chemical;

import com.banana.manager.forest.entity.chemical.DeviceBean;
import com.banana.manager.forest.service.impl.chemical.DeviceServiceImpl;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/device")
public class DeviceController {

    @Resource
    private DeviceServiceImpl deviceService;

    @PostMapping("/addDevice")
    public DeviceBean addDevice(@RequestBody DeviceBean device){
        return deviceService.addDevice(device);
    }

    @GetMapping("/displayDevice")
    public PageInfo<DeviceBean> displayAll(Integer page, String deviceName, String deviceMeasure, String deviceType){
        return deviceService.findBlurPage(page, deviceName, deviceMeasure, deviceType);
    }

    @GetMapping("/showDevice")
    public DeviceBean findOneDevice(Integer deviceId){
        return deviceService.findById(deviceId);
    }

}
